From 5b013ee25684e0d3fb155123bd8ae33b8d465d60 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Fri, 7 Oct 2005 16:49:29 +0100 Subject: [PATCH] Rationalise xenstore header files a little. xenstored.h, which defines aspects of the 'wire' protocol between xs daemon and clients in user and kernel land, is now xs_wire.h and moved to xen's public/io directory. From there it is more easily accessible by kernels. Signed-off-by: Keir Fraser --- .hgignore | 2 +- linux-2.6-xen-sparse/arch/ia64/Makefile | 4 ---- .../drivers/xen/xenbus/xenbus_dev.c | 1 - .../drivers/xen/xenbus/xenbus_xs.c | 1 - linux-2.6-xen-sparse/include/asm-xen/xenbus.h | 4 +--- linux-2.6-xen-sparse/mkbuildtree | 3 --- tools/xenstore/speedtest.c | 2 +- tools/xenstore/xenstored_core.c | 1 - tools/xenstore/xenstored_core.h | 1 - tools/xenstore/xs.c | 2 -- tools/xenstore/xs.h | 10 +--------- tools/xenstore/xs_crashme.c | 17 +---------------- tools/xenstore/xs_lib.h | 2 ++ .../include/public/io/xs_wire.h | 11 +++++------ 14 files changed, 12 insertions(+), 49 deletions(-) rename tools/xenstore/xenstored.h => xen/include/public/io/xs_wire.h (89%) diff --git a/.hgignore b/.hgignore index 7dddc93cae..72b8f826d7 100644 --- a/.hgignore +++ b/.hgignore @@ -155,7 +155,7 @@ ^tools/xenstore/xenstore-read$ ^tools/xenstore/xenstore-rm$ ^tools/xenstore/xenstore-write$ -^tools/xenstore/xs_dom0_test$ +^tools/xenstore/xs_crashme$ ^tools/xenstore/xs_random$ ^tools/xenstore/xs_stress$ ^tools/xenstore/xs_tdb_dump$ diff --git a/linux-2.6-xen-sparse/arch/ia64/Makefile b/linux-2.6-xen-sparse/arch/ia64/Makefile index e0751e9328..6e46f892de 100644 --- a/linux-2.6-xen-sparse/arch/ia64/Makefile +++ b/linux-2.6-xen-sparse/arch/ia64/Makefile @@ -88,7 +88,6 @@ archclean: CLEAN_FILES += include/asm-ia64/.offsets.h.stamp vmlinux.gz bootloader #CLEAN_FILES += include/asm-xen/xen-public include/asm-ia64/xen/asm-xsi-offsets.h -#CLEAN_FILES += include/asm-xen/linux-public/xenstored.h #CLEAN_FILES += include/asm-xen/linux-public include/asm-xen/asm-ia64/hypervisor.h MRPROPER_FILES += include/asm-ia64/offsets.h @@ -119,9 +118,6 @@ include/asm-ia64/.offsets.h.stamp: # [ -e include/asm-xen/linux-public ] \ # || ln -s $(XEN_PATH)/linux-2.6-xen-sparse/include/asm-xen/linux-public \ include/asm-xen/linux-public - [ -e include/asm-xen/linux-public/xenstored.h ] \ - || ln -s $(XEN_PATH)/tools/xenstore/xenstored.h \ - include/asm-xen/linux-public/xenstored.h [ -e include/asm-xen/asm-ia64/hypervisor.h ] \ || ln -s $(XEN_PATH)/linux-2.6-xen-sparse/include/asm-xen/asm-ia64/hypervisor.h \ include/asm-xen/asm-ia64/hypervisor.h diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c index 45ccdfa3be..a1d24be2b4 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c @@ -44,7 +44,6 @@ #include #include #include -#include struct xenbus_dev_data { /* Are there bytes left to be read in this message? */ diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c index d239f6fccc..744576c02f 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c @@ -38,7 +38,6 @@ #include #include #include -#include #include "xenbus_comms.h" #define streq(a, b) (strcmp((a), (b)) == 0) diff --git a/linux-2.6-xen-sparse/include/asm-xen/xenbus.h b/linux-2.6-xen-sparse/include/asm-xen/xenbus.h index 821aca1da8..219cc96b4f 100644 --- a/linux-2.6-xen-sparse/include/asm-xen/xenbus.h +++ b/linux-2.6-xen-sparse/include/asm-xen/xenbus.h @@ -33,9 +33,7 @@ #include #include #include - -/* FIXME there's got to be a better way to get at the XS_WATCH macros */ -#include +#include /* A xenbus device. */ struct xenbus_device { diff --git a/linux-2.6-xen-sparse/mkbuildtree b/linux-2.6-xen-sparse/mkbuildtree index cf7b0f59bb..ba89b1982d 100755 --- a/linux-2.6-xen-sparse/mkbuildtree +++ b/linux-2.6-xen-sparse/mkbuildtree @@ -113,9 +113,6 @@ mkdir ${AD}/include/asm-xen/xen-public cd ${AD}/include/asm-xen/xen-public relative_lndir ../../../${RS}/../xen/include/public -cd ${AD}/include/asm-xen/linux-public -ln -sf ../../../${RS}/../tools/xenstore/xenstored.h - # Arch-specific post-processing cd ${AD} if [ -x arch/${LINUX_ARCH}/xen-mkbuildtree-post ]; then diff --git a/tools/xenstore/speedtest.c b/tools/xenstore/speedtest.c index 9fa1caea54..632e926f56 100644 --- a/tools/xenstore/speedtest.c +++ b/tools/xenstore/speedtest.c @@ -98,7 +98,7 @@ int main(int argc, char *argv[]) if (i % print == 0) write(1, ".", 1); - if (!xs_transaction_start(h, "/")) { + if (!xs_transaction_start(h)) { kill_daemon(pid); barf_perror("Starting transaction"); } diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index da305ad7ce..5e8562ce36 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -44,7 +44,6 @@ #include "list.h" #include "talloc.h" #include "xs_lib.h" -#include "xenstored.h" #include "xenstored_core.h" #include "xenstored_watch.h" #include "xenstored_transaction.h" diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h index 1967d8425c..e0e4d58886 100644 --- a/tools/xenstore/xenstored_core.h +++ b/tools/xenstore/xenstored_core.h @@ -26,7 +26,6 @@ #include #include #include "xs_lib.h" -#include "xenstored.h" #include "list.h" #include "tdb.h" diff --git a/tools/xenstore/xs.c b/tools/xenstore/xs.c index 4f21bbc590..1b405f18f4 100644 --- a/tools/xenstore/xs.c +++ b/tools/xenstore/xs.c @@ -33,8 +33,6 @@ #include #include #include "xs.h" -#include "xenstored.h" -#include "xs_lib.h" #include "utils.h" struct xs_handle diff --git a/tools/xenstore/xs.h b/tools/xenstore/xs.h index 351f55a410..3a3b94000b 100644 --- a/tools/xenstore/xs.h +++ b/tools/xenstore/xs.h @@ -20,18 +20,10 @@ #ifndef _XS_H #define _XS_H -#include "xs_lib.h" +#include struct xs_handle; -/* FIXME we shouldn't have to declare this in two places, what's the right - way to share things between xenstored.h and xs.h? */ -enum xs_watch_type -{ - XS_WATCH_PATH = 0, - XS_WATCH_TOKEN, -}; - /* On failure, these routines set errno. */ /* Connect to the xs daemon. diff --git a/tools/xenstore/xs_crashme.c b/tools/xenstore/xs_crashme.c index 748c64a2d4..9d708ba2eb 100644 --- a/tools/xenstore/xs_crashme.c +++ b/tools/xenstore/xs_crashme.c @@ -24,7 +24,6 @@ #include "xs.h" #include "talloc.h" #include -#include "xenstored.h" #define XSTEST #define RAND_FREQ 128 /* One char in 32 is corrupted. */ @@ -231,20 +230,6 @@ static char *random_path(void) return ret; } -static int random_flags(int *state) -{ - switch (get_randomness(state) % 4) { - case 0: - return 0; - case 1: - return O_CREAT; - case 2: - return O_CREAT|O_EXCL; - default: - return get_randomness(state); - } -} - /* Do the next operation, return the results. */ static void do_next_op(struct xs_handle *h, bool verbose) { @@ -315,7 +300,7 @@ static void do_next_op(struct xs_handle *h, bool verbose) case 7: { if (verbose) printf("START %s\n", name); - xs_transaction_start(h, name); + xs_transaction_start(h); break; } case 8: { diff --git a/tools/xenstore/xs_lib.h b/tools/xenstore/xs_lib.h index 91abd4680c..d446a1cc9c 100644 --- a/tools/xenstore/xs_lib.h +++ b/tools/xenstore/xs_lib.h @@ -23,6 +23,8 @@ #include #include #include +#include +#include /* Bitmask of permissions. */ enum xs_perm_type { diff --git a/tools/xenstore/xenstored.h b/xen/include/public/io/xs_wire.h similarity index 89% rename from tools/xenstore/xenstored.h rename to xen/include/public/io/xs_wire.h index a84018d8e7..b530acf824 100644 --- a/tools/xenstore/xenstored.h +++ b/xen/include/public/io/xs_wire.h @@ -1,5 +1,6 @@ /* - * Simple prototyle Xen Store Daemon providing simple tree-like database. + * Details of the "wire" protocol between Xen Store Daemon and client + * library or guest kernel. * Copyright (C) 2005 Rusty Russell IBM Corporation * * This file may be distributed separately from the Linux kernel, or @@ -24,8 +25,8 @@ * IN THE SOFTWARE. */ -#ifndef _XENSTORED_H -#define _XENSTORED_H +#ifndef _XS_WIRE_H +#define _XS_WIRE_H enum xsd_sockmsg_type { @@ -86,12 +87,10 @@ struct xsd_sockmsg /* Generally followed by nul-terminated string(s). */ }; -/* FIXME we shouldn't have to declare this in two places, what's the right - way to share things between xenstored.h and xs.h? */ enum xs_watch_type { XS_WATCH_PATH = 0, XS_WATCH_TOKEN, }; -#endif /* _XENSTORED_H */ +#endif /* _XS_WIRE_H */ -- 2.30.2